<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>WebRTC</title>
</head>

<body>
  <div class="container">
    <button>开始</button>
  </div>
  <script>
    const button = document.querySelector('button');
    button.addEventListener('click', () => {
      console.log(navigator.mediaDevices)
      // navigator.mediaDevices.getUserMedia({
      //   audio: true,
      //   // video: true
      // }).then(stream => {
      //   const video = document.createElement('video');
      //   video.srcObject = stream;
      //   video.play();
      // }).catch(err => {
      //   console.log('Error:', err);
      // })
    });
  </script>
</body>

</html>